package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"github.com/flopp/go-findfont"
	"os"
	"strings"
)

var setting *Setting
var btcApp fyne.App

func main() {
	a := app.NewWithID("btc")
	w := a.NewWindow("比特币")
	btcApp = a

	w.SetContent(NewBtcFrame(w))
	w.Resize(fyne.NewSize(800, 500))
	w.ShowAndRun()
}

func init() {
	//设置中文字体:解决中文乱码问题
	fontPaths := findfont.List()
	for _, path := range fontPaths {
		if strings.Contains(path, "msyh.ttf") || strings.Contains(path, "simhei.ttf") || strings.Contains(path, "simsun.ttc") || strings.Contains(path, "simkai.ttf") {
			os.Setenv("FYNE_FONT", path)
			break
		}
	}

	setting = NewSetting()
	bc = NewBtcContext()
	InitListConfig()
}
